package cfdt.ldl.business.service.lawyer;

import cfdt.common.vo.PageBaseResponse;
import cfdt.common.vo.PageData;
import cfdt.ldl.business.api.request.GetLawyerInfoListBusinessRequest;
import cfdt.common.vo.ObjectBaseResponse;
import cfdt.ldl.db.biz.LawyerInfoBiz;
import cfdt.ldl.core.entity.LawyerInfo;
import cfdt.ldl.db.util.PageUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 
 * 黑名单检查-实现类
 *
 * <pre>
 * Modify Information:
 * Author       Date          Description
 * ============ ============= ============================
 * wangxiao      2021年8月16日下午2:21:57      创建实现类
 *
 * </pre>
 */
@Service
public class LawyerBusinessService {

    private static final Logger logger = LoggerFactory.getLogger(LawyerBusinessService.class);

    @Autowired
    private LawyerInfoBiz lawyerInfoBiz;

    public PageBaseResponse<LawyerInfo> getLawyerInfoList(GetLawyerInfoListBusinessRequest request) {
        QueryWrapper<LawyerInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.like(StrUtil.isNotEmpty(request.getName()), "NAME", request.getName());
        // 分页查询
        IPage<LawyerInfo> page = new Page<>(request.getPageNum(), request.getPageSize());
        page = lawyerInfoBiz.page(page, queryWrapper);
        // 将分页数据转换为PageData
        PageData<LawyerInfo> pageData = PageUtil.convertPage(page);
        // 响应
        return PageBaseResponse.success(pageData);
    }
}
